﻿using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _010_Log4NetTestInFramework
{
    public class LogHelper
    {
        private static readonly ILog logInfo = LogManager.GetLogger("loginfo");
        private static readonly ILog errorInfo = LogManager.GetLogger("logerror");

        public static void WriteLog(string log)
        {
            if (logInfo.IsInfoEnabled)
            {
                logInfo.Info(log);
            }
            else
            {
                Console.WriteLine("InfoLog IS not Open!");
            }
        }

        public static void WriteError(string log, Exception ex)
        {
            if (errorInfo.IsErrorEnabled)
            {
                errorInfo.Error(log, ex);
            }
        }
    }
}
